import request from "@/utils/request";

// 查询运单列表
export function listShipment(query) {
  return request({
    url: "/system/bill/list",
    method: "get",
    params: query,
  });
}

// 查询运单详细
export function getShipment(id) {
  return request({
    url: "/system/bill/" + id,
    method: "get",
  });
}

// 新增运单
export function addShipment(data) {
  return request({
    url: "/system/bill",
    method: "post",
    data: data,
  });
}

// 修改运单
export function updateShipment(data) {
  return request({
    url: "/system/bill",
    method: "put",
    data: data,
  });
}

// 删除运单
export function delShipment(id) {
  return request({
    url: "/system/bill/" + id,
    method: "delete",
  });
}

// 批量删除运单
export function delShipmentBatch(ids) {
  return request({
    url: "/system/bill/" + ids,
    method: "delete",
  });
}

// 导出运单
export function exportShipment(query) {
  return request({
    url: "/system/bill/export",
    method: "post",
    data: query,
    responseType: "blob",
  });
}

// 获取运单历史记录
export function getShipmentHistory(query) {
  return request({
    url: "/system/bill/history",
    method: "get",
    params: query,
  });
}

// 获取运单轨迹信息
export function getShipmentTrack(query) {
  return request({
    url: "/system/bill/track",
    method: "get",
    params: query,
  });
}

// 运单状态更新
export function updateShipmentStatus(data) {
  return request({
    url: "/system/bill/status",
    method: "put",
    data: data,
  });
}

// 查询运单统计信息
export function getShipmentStatistics(query) {
  return request({
    url: "/system/bill/statistics",
    method: "get",
    params: query,
  });
}

// 以下为兼容性保留的API（别名）
export const listBill = listShipment;
export const getBill = getShipment;
export const addBill = addShipment;
export const updateBill = updateShipment;
export const delBill = delShipment;
